The other problem that you would have in order to make shunning illegal is that each baptized member prior to them being baptized is given a copy of the church's bylaws and is encouraged to read them. In fact prior to baptism the questions to determine if someone can qualify for baptism is taken out of that book. That book on page 140 states:
IF THE DECISION IS TO DISFELLOWSHIP
25 In some cases, the wrongdoer will have become hardened in his course of sinful conduct and will thus fail to respond to efforts to help him. Sufficient “works that befit repentance” may not be in evidence at the time of the judicial hearing. (Acts 26:20) What then? In such cases, it is necessary to expel the unrepentant wrongdoer from the congregation, thus denying him fellowship with Jehovah’s clean people. The bad influence of the wrongdoer is removed from the congregation, thereby safeguarding its moral and spiritual cleanness and protecting its good name.
Each person who is baptized agrees to live by those bylaws.